package com.fly.client1.controller;

import com.fly.client1.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName TestController
 * @Description TODO
 * @Author Fly
 * @Version
 * @Date 2020/1/7 16:34
 */
@RequestMapping
@RestController
public class TestController {
    @Autowired
    private OAuth2RestTemplate oAuth2RestTemplate;

    @GetMapping("test")
    public Result<String> test(){
        String result = oAuth2RestTemplate.getForObject("http://localhost:8082/client2/test2", String.class);
        return Result.ok(result);
    }
}
